package main

import (
	"fmt"
	"gocv.io/x/gocv"
	"image"
)

var model = gocv.ReadNetFromONNX("/Users/ljq/code/weight/ShipWeight_6-25_0.96.onnx")

func TrackSide(img gocv.Mat) {
	//图像预处理
	Shipimg := gocv.BlobFromImage(img, 1/255.0, image.Point{X: 224, Y: 224}, gocv.Scalar{}, true, false)
	//
	model.SetInput(Shipimg, "input")
	//输出的是Mat对象
	out := model.Forward("output")

	var shipout []float32
	shipout, _ = out.DataPtrFloat32()
	//fmt.Printf("out",shipout,"\n")

	if shipout[0] > shipout[1] {
		fmt.Printf("这是轻载\n")

	} else {
		fmt.Printf("这是重载船\n")
	}
}
